//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;

using OpenLS.Drawing;
using System.Windows.Controls;

namespace OpenLS.Spreadsheet.UI
{
    partial class WorksheetResources
    {
        public WorksheetResources()
        {
            InitializeComponent();
        }

        static Worksheet GetWorksheet(object sender)
        {
            return WorksheetHelper.GetWorksheet(sender);
        }
        void OnSetTheme(object sender, ExecutedRoutedEventArgs args)
        {
            Worksheet worksheet = GetWorksheet(sender);
            worksheet.Workbook.Theme = (Theme)args.Parameter;
            args.Handled = true;
        }
        void OnSetColorScheme(object sender, ExecutedRoutedEventArgs args)
        {
            Worksheet worksheet = GetWorksheet(sender);
            worksheet.Workbook.Theme.ColorScheme = (ColorScheme)args.Parameter;
            args.Handled = true;
        }
        void OnSetFontScheme(object sender, ExecutedRoutedEventArgs args)
        {
            Worksheet worksheet = GetWorksheet(sender);
            worksheet.Workbook.Theme.FontScheme = (FontScheme)args.Parameter;
            args.Handled = true;
        }
        void OnSelectAll(object sender, ExecutedRoutedEventArgs args)
        {

            Worksheet worksheet = GetWorksheet(sender);
            SpreadsheetElement.SetCurrentRangeForRoot(sender, new FullWorksheetRange(worksheet), null);
            //Worksheet.Selection = new FullWorksheetRange(Worksheet);
        }

        void OnTrue(object sender, CanExecuteRoutedEventArgs args)
        {
            args.CanExecute = true;
            args.Handled = true;
        }

    }
}
